<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Video extends Base
{
    public static function add($map)
    {
//        $rew = self::where('file',$map['file'])->get();
        $res = self::where('name',$map['name'])->get();

        if(!$res->isEmpty()){
            return 300;
        }

        $result = self::create($map);
        if($result){
            return 200;
        }

    }


    public function level1()
    {
        return $this->belongsTo('App\SubTwo','level1','id');
    }

    public function level2()
    {
        return $this->belongsTo('App\SubTwo','level2','id');
    }

    public function image()
    {
        return $this->belongsTo('App\Image','url','id');
    }
}
